package com.android.hidephotosplus.view;

import com.android.hidephotosplus.R;

import android.content.Context;
import android.preference.Preference;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MPreference extends Preference{
	
	private TextView title;

	private TextView sum;

	public MPreference(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	@Override
	protected View onCreateView(ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) getContext()
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = inflater.inflate(R.layout.preference, parent, false);
		title = (TextView) view.findViewById(R.id.title);
		sum = (TextView) view.findViewById(R.id.sum);

		title.setText(getTitle());

		if (getSummary() == null && TextUtils.isEmpty(getSummary()))
			sum.setVisibility(View.GONE);
		else {
			sum.setText(getSummary());
			sum.setVisibility(View.VISIBLE);
		}

		return view;
	}

}
